/*-------------------------------------------------------------------------------
 -- Title      : x264 acceleration   
 -- Project    : 
-------------------------------------------------------------------------------
 -- File       : x264_rovex.c
 -- Author     : Alex Luna 
		 Javier James
 -- School     : Technical University Delft 
 -- Created    : Sun 10 Nov. 2013
 -- Last update: Syn 10 Nov. 2013
 -- Platform   : FPGA ml640 , rovex and microblaze
 -- Standard   : C90
 -------------------------------------------------------------------------------
 -- Description: The application is part of the test which tries to get the bytecode and bytedata loaded in IMEM and DMEM automatically   

        Data mapping for dmem: 
	parameter1:  0x120 - 0x120  1 bytes
	parameter2:  0x121 - 0x121  1 bytes 
	result:  0x120 - 0x124    4 bytes

-------------------------------------------------------------------------------
 -- Revisions Last update:
 -- Date        Version  Author        Description
 -- 2013-11-10  1.0      Javier        Created
-------------------------------------------------------------------------------
*/

#include <stdlib.h>
#include <stdio.h>

#define DATA_SIZE 1 


typedef char uint8_t;
typedef unsigned short int  uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;
typedef long intptr_t; 
typedef uint8_t  pixel;
typedef uint16_t sum_t;
typedef uint32_t sum2_t;








/* global variables declaration */
extern char __DATA_START;

/* function declarations */

int sub ( char a, char b ); 


/*main function*/
int main(int argc, char **argv) 
{
    pixel *pixel1=NULL;		
    pixel *pixel2=NULL;		

    int *kernel_result=NULL;		
    int i;			
   char a,b; 

    pixel1 = (char *) &__DATA_START ;            // 0X120
    pixel2 = (char *) &__DATA_START + DATA_SIZE; // 0X140
     kernel_result = (int *) 0x120;

//-------------------------------------------------------------------------------
//    Calculate return value and send to Dmem
//-------------------------------------------------------------------------------

    /* Store result at location pointed by kernel_result */
    *kernel_result = sub(*pixel1,*pixel2 ) ;
	
   //*kernel_result = *pixel2; 

//	*pixel1= *pixel1 +1; 
//	*pixel2= *pixel2 +2; 

    return 0;
}//end main function


int sub( char a, char b ) 
//int add ( pixel a, pixel b ) 
{
    return (a-b);

}







